<template>
  <div class="risk-content">
    <eagle-tab-page-list
      url="/DangerCheckTaskDetail/GetHiddenDangerPageData"
      :params="params"
      @initActive="_initActive"
      @initList="_initList"
      ref="eagleTabPageList"
    >
      <template v-if="this.active === 0">
        <eagle-cell class="card" v-for="(item, index) in list" :key="index">
          <div class="warn_item">
            <div @click="goDetail(item)">
              <div class="f14">
                <div v-if="item.IsCorrect">
                  {{ index + 1 }}、隐患描述：{{ item.HiddenDangerDesc }}
                </div>
                <div v-if="!item.IsCorrect" style="color: red">
                  {{ index + 1 }}、隐患描述：{{ item.HiddenDangerDesc }}
                </div>
              </div>

              <eagle-row gutter="20" class="dep_sort">
                <eagle-col span="24">
                  <img
                    src="@/assets/Images/AppIcon/icon_list_task.png"
                    alt=""
                  />所属任务：{{ item.CheckTaskName }}</eagle-col
                >
              </eagle-row>

              <eagle-row gutter="20" class="dep_sort">
                <eagle-col span="24">
                  <img
                    src="@/assets/Images/AppIcon/icon_list_area.png"
                    alt=""
                  />{{ item.HiddenDangerArea || "暂无区域" }}</eagle-col
                >
              </eagle-row>
              <eagle-row gutter="20" class="dep_sort">
                <eagle-col span="10">
                  <img
                    src="@/assets/Images/AppIcon/icon_list_user.png"
                    alt=""
                  />{{ item.CreateChnName }}</eagle-col
                >
                <eagle-col span="14">
                  <img
                    src="@/assets/Images/AppIcon/icon_list_date.png"
                    alt=""
                  />{{ getDateTime(item.CreateDate) }}</eagle-col
                >
              </eagle-row>
            </div>
          </div>
        </eagle-cell>
      </template>
      <template v-if="this.active === 1">
        <eagle-cell class="card" v-for="(item, index) in list" :key="index">
          <div class="warn_item">
            <div @click="goSureDetail(item)">
              <div class="f14">
                <div>
                  {{ index + 1 }}、隐患描述：{{ item.HiddenDangerDesc }}
                </div>
              </div>

              <eagle-row gutter="20" class="dep_sort">
                <eagle-col span="24">
                  <img
                    src="@/assets/Images/AppIcon/icon_list_task.png"
                    alt=""
                  />所属任务：{{ item.CheckTaskName }}</eagle-col
                >
              </eagle-row>
              <eagle-row gutter="20" class="dep_sort">
                <eagle-col span="24">
                  <img
                    src="@/assets/Images/AppIcon/icon_list_area.png"
                    alt=""
                  />{{ item.HiddenDangerArea || "暂无区域" }}</eagle-col
                >
              </eagle-row>
              <eagle-row gutter="20" class="dep_sort">
                <eagle-col span="10">
                  <img
                    src="@/assets/Images/AppIcon/icon_list_user.png"
                    alt=""
                  />{{ item.CreateChnName }}</eagle-col
                >
                <eagle-col span="14">
                  <img
                    src="@/assets/Images/AppIcon/icon_list_date.png"
                    alt=""
                  />{{ getDateTime(item.CreateDate) }}</eagle-col
                >
              </eagle-row>
            </div>
          </div>
        </eagle-cell>
      </template>
    </eagle-tab-page-list>
  </div>
</template>

<script>
import { getDateTime } from "@/utils/getDate";
export default {
  data() {
    return {
      params: [
        {
          title: "未确认隐患",
          dataType: "ToBeConfirm",
          badge: true,
        },
        {
          title: "已确认隐患",
          dataType: "BeConfirmed",
          badge: false,
        },
      ],
      list: [],
      active: 0,
    };
  },
  created() {},
  methods: {
    _initActive(active) {
      this.active = active;
    },
    _initList(list) {
      this.list = list;
    },
    getDateTime(value) {
      return getDateTime(value);
    },
    // 详情
    goDetail(item) {
      this.$router.push({
        path: "/Danger/DangerCheckTaskDetailEdit",
        query: { id: item.ID },
      });
    },
    // 已确认
    goSureDetail(item) {
      this.$router.push({
        path: "/Danger/DangerCheckDetailView",
        query: { id: item.ID, type: "confirmed" },
      });
    },
    getFile(equipmentCode) {
      this.$router.push({
        path: "/Equipment/safetyfile",
        query: { equipmentCode: equipmentCode },
      });
    },
  },
};
</script>

<style lang="less" scoped>
.risk-content {
  background-color: #e8f1f8;
  .info_search {
    padding: 10px;
    border-radius: 5px !important;
    .van-field__control {
      background-color: #ffffff !important;
    }
  }
}
.all_dep {
  background-color: #ffffff;
}

.warn_item {
  /*margin-bottom: 10px;*/
  // padding: 10px 0 10px 10px;
  border-radius: 5px;
  position: relative;
}

.dep_sort {
  // display: flex;
  // flex-wrap: wrap;
  // margin-bottom: 5px;
  img {
    height: 15px;
    width: 15px;
    margin-right: 5px;
  }
}
.dep_btm {
  display: flex;
  justify-content: flex-end;
  .btm_item {
    display: flex;
    align-items: center;
    img {
      height: 15px;
      width: 15px;
      margin-right: 5px;
    }
  }
}
</style>
